home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: GraphicsToolboxLibrary.c Contains: graphics libraries - graphics toolbox routines Written by: Cary Clark, Georgiann Delaney, Michael Fairman, Dave Good, Robert Johnson, Keith McGreggor, Mike Reed, Oliver Steele, David Van Brink, Chris Yerga Copyright: © 1995 by Apple Computer, Inc., all rights reserved. Change History (most recent first): <1> 1/9/95 JD First checked in. */ #include <Memory.h> #include <Resources.h> #include <GXFonts.h> #include "GraphicsToolboxLibrary.h" /* jtdfix - is this file needed?? */ #define segmentLoaderTrashesResLoadState #ifdef segmentLoaderTrashesResLoadState #define SETRESLOAD(load) SetResLoad(load) #else #define SETRESLOAD(load) #endif long AddResFileFonts(short resFileID, gxFont** fonts) { long i, count; long validFonts = 0; char resLoadState = *(char*)0xa5e; short oldResFile = CurResFile(); UseResFile(resFileID); count = Count1Resources('sfnt'); if (fonts) SetHandleSize((Handle)fonts, count * sizeof(gxFont)); SetResLoad(false); for (i = 1; i <= count; i++) { Handle sfnt; SETRESLOAD(false); sfnt = Get1IndResource('sfnt', i); if (sfnt && !ResError()) { gxFont fontID = GXNewFont(gxResourceFontStorage, sfnt, 0); if (fonts) (*fonts)[validFonts] = fontID; validFonts++; } } SetResLoad(resLoadState); if (fonts && validFonts != count) SetHandleSize((Handle)fonts, validFonts * sizeof(gxFont)); UseResFile(oldResFile); return validFonts; }